package com.sgb.kjwl.view.ui.adapter.machine;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemCarList3Binding;
import com.sgb.kjwl.model.entity.lease.CarListEntity3;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.DateUtils;

import java.util.List;

//车辆适配器
public class CarListAdapter3 extends BaseRecycleAdapter<CarListEntity3> {

    ItemCarList3Binding binding;

    public CarListAdapter3(Context context, List<CarListEntity3> datas) {
        super(context, R.layout.item_car_list3, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final CarListEntity3 entity) {
        holder.setBinding(BR.viewModel, entity);
        binding = (ItemCarList3Binding) holder.getmBinding();
        binding.tvIsSelf.setVisibility("1".equals(entity.getIsSelf()) ? View.VISIBLE : View.INVISIBLE);
        binding.tvArea.setText(entity.getCityName() + " " + entity.getDistrictName());
        binding.priceView.setText("" + entity.getPrice());
        try {
            binding.tvTime.setText(DateUtils.stampToDay(entity.getTime()));
        } catch (Exception e) {
        }
    }
}
